#!/bin/sh
root=$(cd `dirname $0`; pwd)

cd $root/Server
date > time.txt
sleep 1
openssl genrsa -out ca.key -rand time.txt
openssl pkcs8 -topk8 -inform PEM -in ca.key -outform pem -nocrypt -out pkcs8.pem
openssl req -out ca.crt -key ca.key -x509 -days 365 -subj "/C=CN/ST=FAKE/L=FAKE/O=FAKE/CN=FAKE/emailAddress=FAKE@FAKE.Server"

cd ../Client
date > time.txt
openssl genrsa -out ca.key -rand time.txt
openssl req -out ca.crt -key ca.key -x509 -days 365 -subj "/C=CN/ST=FAKE/L=FAKE/O=FAKE/CN=FAKE/emailAddress=FAKE@FAKE.Client"
cd ../
./build/TestTLS13S > server.log &
sleep 1
./build/TestTLS13C > client.log
sleep 2